package com.xq.chrome.web.other.conf;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;

/**
 * 配置JackSon 对时间进行转换
 */
//@Component
public class JacksonConf extends ObjectMapper {
  public JacksonConf() {
    this.setSerializationInclusion(JsonInclude.Include.NON_NULL);
    this.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
    this.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
  }
}
